//
//  QuotesViewModel.m
//  CBT
//
//  Created by Mr.Zhang on 2018/12/6.
//  Copyright © 2018 Mr.Zhang. All rights reserved.
//

#import "QuotesViewModel.h"
#import "WCOrderListModel.h"

@implementation QuotesViewModel

- (instancetype)init
{
    if (self = [super init]) {
        [self initialize];
    }
    return self;
}

- (void)initialize
{
    self.quotesListSuccessObject     = [RACSubject subject];
    self.quotesListFailureObject     = [RACSubject subject];
}

-(void)exchangeDataWithPage:(NSInteger)page
{
    @weakify(self);
    [QuotesManager getOrderListWithPage:page Block:^(id data, HttpRequestResult result, NSString *msg) {
        if (result == kHttpRequestResultNormal) {
            NSArray *modelArray = [WCOrderListModel mj_objectArrayWithKeyValuesArray:[data[@"data"]objectForKey:@"invitedList"]];
            [self_weak_.quotesListSuccessObject sendNext:modelArray];
        }else{
            [self_weak_.quotesListFailureObject sendNext:nil];
        }
    }];
}

@end
